// ignore_for_file: prefer_interpolation_to_compose_strings, avoid_print, prefer_const_constructors, unnecessary_this

import 'package:get/get.dart';

class WorkController extends GetxController {

  final _obj = 0.obs;
  set obj(value) => this._obj.value = value;
  get obj => this._obj.value;
  add()=> _obj.value ++;

  @override
  void onInit() {
    
    super.onInit();

    // 每次
    ever(_obj, (value) => {
      print("ever -> " + value.toString())
    });
    once(_obj, (value) {
      print("once -> " + value.toString());
    });

    // 防抖 2 秒内
    debounce(
      _obj,
      (value) {
        print("debounce -> " + value.toString());
      },
      time: Duration(seconds: 2),
    );
    interval(
      _obj,
      (value) {
        print("interval -> " + value.toString());
      },
      time: Duration(seconds: 1),
    );
  }
}